import axios from "@/utils/request.js";
//登录
export function logIn(data) {
  return axios({
    url: "/login",
    method: "post",
    data
  })
}
// 注册
export const singIn = data => axios({
  url: "/register",
  method: "post",
  data
})
// 用户信息
export const getUserInfo = (id) => axios({
  url: "/user/" + id,

})
// 更新用户信息
export const userUpdate = (id, data) => axios({
  url: "/user_update/" + id,
  method: "post",
  data
})
// 上传文件
export const userUpload = (data) => axios({
  url: "/upload/",
  method: "post",
  data
})
// 用户关注列表
export const userAttention = params => axios({
  url: "/user_follows",
  params
})
// 栏目列表
export const category = params => axios({
  url: "/category",
  params
})
// 文章列表
export const articleList = params => axios({
  url: "/post",
  params
})
// 新闻详情
export const newsDetails = (id) => axios({
  url: "/post/" + id
})
// 关注
export const userFollows = id => axios({
  url: "/user_follows/" + id
})
// 取消关注
export const userUnfollows = id => axios({
  url: "/user_unfollow/" + id
})
// 评论列表
export const getCommentList = (id) => axios({
  url: "/post_comment/" + id
})
// 点赞
export const like = id => axios({
  url: "/post_like/" + id
})
// 收藏文章
export const postStar = id => axios({
  url: "/post_star/" + id
})
// 收藏文章列表
export const userStar = () => axios({
  url: "/user_star"
})
// 发布评论
export const postComment = (id, data) => axios({
  url: "/post_comment/" + id,
  method: "post",
  data
})
// 发布文章
export const publish = data => axios({
  url: "/post",
  data
})
// 搜索文章
export const search = params => axios({
  url: "/post_search",
  params
})